<?php
header('Content-Type:application/json;charset=UTF-8');

@$type=$_REQUEST['type'];
if(empty($type)){
    echo '[]';
    return;
}

//$conn=mysqli_connect('127.0.0.1','root','','mm',3306);
$conn = mysqli_connect(SAE_MYSQL_HOST_M, SAE_MYSQL_USER, SAE_MYSQL_PASS,  SAE_MYSQL_DB, SAE_MYSQL_PORT);
$sql="SET NAMES UTF8";
mysqli_query($conn,$sql);

$sql="SELECT * FROM mm_items_book WHERE type='$type'";
$result=mysqli_query($conn,$sql);

$arr=[];
while(($book=mysqli_fetch_assoc($result))!=null){

    $arr[]=$book;
}
echo json_encode($arr);





